<form (ngSubmit)="save()" [formGroup]="form">
  <div fxLayout fxLayoutAlign="start center" mat-dialog-title>
    <span fxFlex>{{title|translate}}</span>

    <button color="warn" mat-dialog-close mat-icon-button tabindex="-1" type="button">
      <mat-icon>close</mat-icon>
    </button>
  </div>

  <mat-dialog-content fxLayout="column">
    <mat-form-field>
      <input [placeholder]="'corporation'|translate" [value]="form.value?.corporation.name" matInput readonly required tabindex="-1">
    </mat-form-field>

    <mat-form-field>
      <input [placeholder]="'Common.name'|translate" formControlName="name" matInput required>
      <mat-error *ngIf="form.get('name').hasError('required')">
        {{'Validator.required'|translate}}
      </mat-error>
    </mat-form-field>

    <mat-form-field>
      <input [readonly]="!!form.value.id" formControlName="code" matInput placeholder="CODE" required>
      <mat-hint align="end">sdfsdfa</mat-hint>
      <mat-error *ngIf="form.get('code').hasError('required')">
        {{'Validator.required'|translate}}
      </mat-error>
    </mat-form-field>

    <mat-form-field>
      <mat-select [compareWith]="compareWithId" [placeholder]="'Workshop.sapT001ls'|translate" formControlName="sapT001ls" multiple>
        <mat-option *ngFor="let it of sapT001ls$|async" [value]="it">
          {{it.lgort}}-{{it.lgobe}}
        </mat-option>
      </mat-select>
      <mat-error *ngIf="form.get('sapT001ls').hasError('required')">
        {{'Validator.required'|translate}}
      </mat-error>
      <mat-error *ngIf="form.get('sapT001ls').hasError('minLength')">
        {{'Validator.minLength'|translate:form.get('sapT001ls').getError('minLength')}}
      </mat-error>
    </mat-form-field>
  </mat-dialog-content>

  <mat-dialog-actions align="end">
    <button [disabled]="form.pristine||form.invalid" color="primary" mat-button>{{'Common.finish'|translate}}</button>
  </mat-dialog-actions>
</form>
